Skip to main content

Example: PLC Chat Net Base Services

Product: CODESYS Base Libraries

The sample project consists of a server application and a client application, each with a visualization. A client application communicates with another client application over the server application via TCP (Port 50000). The connection can be either encrypted or unencrypted.

Description

Establishing an unencrypted TCP connection

An unencrypted connection can be established by deactivating the 'Encrypted' switch. For the client application and server application, the IP address of the server has to be specified in the "IP address" field.

Establishing an encrypted TCP connection

An encrypted connection can be established by activating the "Encrypted" switch. In this case, the server has to have stored the client certificates as trusted certificates. The client applications each have to have stored the server certificate as trusted certificates.

Procedure. Configuration of the certificates:
  1. Open the PLC Shell of the device (client and server)

  2. Enter the following command: cert-genselfsigned

  3. Download and install the CODESYS Security Agent tool from the CODESYS Store International (see: https://store.code sys.com/codesys-security-agent.html).

  4. Open the Security Screen view.

  5. Select a specific certificate and save it to the PC.

  6. Save the certificate of the client as a trusted certificate of the server.

  7. Save each certificate of the server as a trusted certificate of the client.

  8. In the TCP_Client and TCP_Server programs, the info variable has to be set to the name (CN) of the specified certificate.

The Go Online button can be used to activate the server and establish a connection between the clients and the server.

System requirements and restrictions

Programming system

CODESYS Development System (version 3.5.16.0 or higher)

Runtime system

CODESYS Control Win (version 3.5.16.0)

Add-on components

-

Note

_example_icon.png DOWNLOAD Project